<template>
    <div class="goodsdesc-container">
        <h1>{{ info.title }}</h1>
        <hr>
        <div class="content" v-html="info.content"></div>
    </div>
</template>

<script>
    import { Toast } from 'mint-ui'
    export default {
        data() {
            return {
                id: this.$route.params.id,   //获取当前路由的id
                info: {}  //图文数据
            }
        },
        created() {   //数据加载完毕自动调取方法
            this.getGoodsDesc()
        },
        methods: {
            getGoodsDesc() {   //获取图文数据
                this.$http.get('api/goods/getdesc/' + this.id).then(result => {
                    if (result.body.status === 0) {
                        //成功
                        this.info = result.body.message[0]
                    } else {
                        // 失败
                        Toast('获取数据失败了。。。')
                    }
                })
            }
        }
    }
</script>

<style scoped lang="scss" type="text/scss">
    .goodsdesc-container {
        padding: 5px;
        h1 {
            font-size: 16px;
            margin: 15px 0;
            color: #226aff;
            text-align: center;
        }
        /deep/.content {
            img {
                width: 100%;
            }
        }
    }
</style>